import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib import cm

#Data 
data_2b = pd.read_excel('./dataSet/Trade Statistics Data/2b - Imports.xlsx')

corp_year_2b = data_2b.loc[2].values.tolist()
del corp_year_2b[0:1]

total_production = data_2b.loc[40].values.tolist()
del total_production[0:1]

martix_2b=pd.read_excel('./dataSet/Trade Statistics Data/2b_martix.xlsx')
countries_2b = pd.read_excel('./dataSet/Trade Statistics Data/2b - Imports.xlsx',usecols = 'A').fillna('0').values.tolist()
del countries_2b[0:3]
while ['0'] in countries_2b:
    countries_2b.remove(['0'])
while ['July group'] in countries_2b:
    countries_2b.remove(['July group'])
while ['October group'] in countries_2b:
    countries_2b.remove(['October group'])
while ['Total'] in countries_2b:
    countries_2b.remove(['Total'])
while ['© International Coffee Organization'] in countries_2b:
    countries_2b.remove(['© International Coffee Organization'])
print(corp_year_2b)
print(total_production)    
print(countries_2b)

x_range_2b = np.arange(len(corp_year_2b))
print(x_range_2b)
fig0, axes0 = plt.subplots(figsize=(20,10))

axes0.set_title("Imports of each year")
axes0.plot(corp_year_2b, total_production,
             color='chocolate', label='Total_Exports')
# axes0.set_xticks(x_range_4b, corp_year_2b, rotation=45)
axes0.xaxis.grid(color='blue', linestyle='--', linewidth=1, alpha=0.3)
axes0.yaxis.grid(color='blue', linestyle='--', linewidth=1, alpha=0.3)
axes0.legend()
plt.show()

    
    
y_range_2b = np.arange(len(countries_2b))   
fig3= plt.figure(figsize=(15, 35))
plt.imshow(martix_2b)
plt.title('Martix of Imports')
plt.xticks(x_range_2b, corp_year_2b, rotation=45)
plt.yticks(y_range_2b,countries_2b)
plt.colorbar(fraction=0.08, pad=0.05)